<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>MineSweep.mxml</title>
<link rel="stylesheet" type="text/css" href="../SourceStyles.css"/>
</head>

<body><pre><span class="MXMLProcessing_Instruction">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>
<span class="MXMLComponent_Tag">&lt;mx:Application</span><span class="MXMLDefault_Text"> xmlns:mx=&quot;</span><span class="MXMLString">http://www.adobe.com/2006/mxml</span><span class="MXMLDefault_Text">&quot; layout=&quot;</span><span class="MXMLString">absolute</span><span class="MXMLDefault_Text">&quot; xmlns:ns1=&quot;</span><span class="MXMLString">com.mechan.MecGrid.*</span><span class="MXMLDefault_Text">&quot; viewSourceURL=&quot;</span><span class="MXMLString">srcview/index.html</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
<span class="MXMLSpecial_Tag">&lt;mx:Script&gt;</span>
    <span class="ActionScriptOperator">&lt;!</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">CDATA</span><span class="ActionScriptBracket/Brace">[</span>
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">mechan</span>.<span class="ActionScriptDefault_Text">samples</span>.<span class="ActionScriptDefault_Text">MineSweeperEvent</span>;
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">mechan</span>.<span class="ActionScriptDefault_Text">samples</span>.<span class="ActionScriptDefault_Text">MineSweeperEvent</span>;
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">mechan</span>.<span class="ActionScriptDefault_Text">samples</span>.<span class="ActionScriptDefault_Text">MineSweeper</span>;
        
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">controls</span>.<span class="ActionScriptDefault_Text">Alert</span>;
        
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">utils</span>.<span class="ActionScriptDefault_Text">Timer</span>;
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">timer</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Timer</span>;
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">startMineSweep</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">mine</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">MineSweeper</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">MineSweeper</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptDefault_Text">mine</span>.<span class="ActionScriptDefault_Text">MineWidth</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">uiMineWidth</span>.<span class="ActionScriptDefault_Text">value</span>;
            <span class="ActionScriptDefault_Text">mine</span>.<span class="ActionScriptDefault_Text">MineHeight</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">uiMineHeight</span>.<span class="ActionScriptDefault_Text">value</span>;
            <span class="ActionScriptDefault_Text">mine</span>.<span class="ActionScriptDefault_Text">MineSize</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">uiMaxMines</span>.<span class="ActionScriptDefault_Text">value</span>;
            <span class="ActionScriptDefault_Text">mine</span>.<span class="ActionScriptDefault_Text">mecGridControl</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">mgrid</span>;
            <span class="ActionScriptDefault_Text">mine</span>.<span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">MineSweeperEvent</span>.<span class="ActionScriptDefault_Text">MINE_BOOMED</span>, <span class="ActionScriptDefault_Text">mineBoomedHandler</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptDefault_Text">mine</span>.<span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">MineSweeperEvent</span>.<span class="ActionScriptDefault_Text">MINE_MISSION_COMPLETED</span>, <span class="ActionScriptDefault_Text">mineMissionCompletedHandler</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptDefault_Text">mine</span>.<span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">MineSweeperEvent</span>.<span class="ActionScriptDefault_Text">MINE_STATE_CHANGED</span>, <span class="ActionScriptDefault_Text">mineStateChangedHandler</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptDefault_Text">uiMineLeft</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">uiMaxMines</span>.<span class="ActionScriptDefault_Text">value</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptDefault_Text">mine</span>.<span class="ActionScriptDefault_Text">StartGame</span><span class="ActionScriptBracket/Brace">()</span>;
            
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(!</span><span class="ActionScriptDefault_Text">timer</span><span class="ActionScriptBracket/Brace">)</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptDefault_Text">timer</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Timer</span><span class="ActionScriptBracket/Brace">(</span>1000, 0<span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">timer</span>.<span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(T</span><span class="ActionScriptDefault_Text">imerEvent</span>.<span class="ActionScriptDefault_Text">TIMER</span>, <span class="ActionScriptDefault_Text">timerHandler</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptDefault_Text">timer</span>.<span class="ActionScriptDefault_Text">reset</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptDefault_Text">uiEllapsedTime</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;0&quot;</span>;
            <span class="ActionScriptDefault_Text">timer</span>.<span class="ActionScriptDefault_Text">start</span><span class="ActionScriptBracket/Brace">()</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">mineBoomedHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">MineSweeperEvent</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">timer</span>.<span class="ActionScriptDefault_Text">stop</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;Mission Failed&quot;</span>, <span class="ActionScriptString">&quot;MecGrid MineSweeper&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">mineMissionCompletedHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">MineSweeperEvent</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">timer</span>.<span class="ActionScriptDefault_Text">stop</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;Misson Completed&quot;</span>, <span class="ActionScriptString">&quot;MecGrid MineSweeper&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">mineStateChangedHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">MineSweeperEvent</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">mine</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">MineSweeper</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">event</span>.<span class="ActionScriptDefault_Text">target</span> <span class="ActionScriptReserved">as</span> <span class="ActionScriptDefault_Text">MineSweeper</span>;
            <span class="ActionScriptDefault_Text">uiMineLeft</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">mine</span>.<span class="ActionScriptDefault_Text">LeftFlags</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">timerHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">TimerEvent</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">uiEllapsedTime</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">Number</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">uiEllapsedTime</span>.<span class="ActionScriptDefault_Text">text</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">+</span> 1<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
        <span class="ActionScriptBracket/Brace">}</span>
    <span class="ActionScriptBracket/Brace">]]</span><span class="ActionScriptOperator">&gt;</span>
<span class="MXMLSpecial_Tag">&lt;/mx:Script&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:Button</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">332</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">25</span><span class="MXMLDefault_Text">&quot; label=&quot;</span><span class="MXMLString">Start Game</span><span class="MXMLDefault_Text">&quot; click=&quot;</span><span class="ActionScriptDefault_Text">startMineSweep</span><span class="ActionScriptBracket/Brace">()</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:NumericStepper</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">51</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">25</span><span class="MXMLDefault_Text">&quot; id=&quot;</span><span class="MXMLString">uiMineHeight</span><span class="MXMLDefault_Text">&quot; value=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; maximum=&quot;</span><span class="MXMLString">50</span><span class="MXMLDefault_Text">&quot; minimum=&quot;</span><span class="MXMLString">5</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:NumericStepper</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">154</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">25</span><span class="MXMLDefault_Text">&quot; id=&quot;</span><span class="MXMLString">uiMineWidth</span><span class="MXMLDefault_Text">&quot; value=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; maximum=&quot;</span><span class="MXMLString">50</span><span class="MXMLDefault_Text">&quot; minimum=&quot;</span><span class="MXMLString">5</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">501</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">27</span><span class="MXMLDefault_Text">&quot; id=&quot;</span><span class="MXMLString">uiMineLeft</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;ns1:MecGrid</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">mgrid</span><span class="MXMLDefault_Text">&quot; right=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; left=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; top=&quot;</span><span class="MXMLString">53</span><span class="MXMLDefault_Text">&quot; bottom=&quot;</span><span class="MXMLString">33</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:NumericStepper</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">256</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">25</span><span class="MXMLDefault_Text">&quot; id=&quot;</span><span class="MXMLString">uiMaxMines</span><span class="MXMLDefault_Text">&quot; value=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; maximum=&quot;</span><span class="MXMLString">50</span><span class="MXMLDefault_Text">&quot; minimum=&quot;</span><span class="MXMLString">5</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">27</span><span class="MXMLDefault_Text">&quot; text=&quot;</span><span class="MXMLString">Rows</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">117</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">27</span><span class="MXMLDefault_Text">&quot; text=&quot;</span><span class="MXMLString">Cols</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">220</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">27</span><span class="MXMLDefault_Text">&quot; text=&quot;</span><span class="MXMLString">Mines</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">431</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">27</span><span class="MXMLDefault_Text">&quot; text=&quot;</span><span class="MXMLString">Mines Left</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">614</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">27</span><span class="MXMLDefault_Text">&quot; id=&quot;</span><span class="MXMLString">uiEllapsedTime</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; text=&quot;</span><span class="MXMLString">Click with Control Keys down to set Bomb Flag</span><span class="MXMLDefault_Text">&quot; bottom=&quot;</span><span class="MXMLString">7</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
<span class="MXMLComponent_Tag">&lt;/mx:Application&gt;</span></pre></body>
</html>
